/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gameai.tickettoride.core;

import java.util.ArrayList;

/**
 *
 * @author nix
 */
  public class Rail{
    
    public static int[] SCORES = {0,1,2,4,7,10,15};
      
    int distance = 0;
    Player[] player = new Player[2]; //1,2,3,4,5,6... OR 0 for available and -1 for doesn't exist
    boolean dual = false;
    int color = 0; //SEE getRailColor
    //int score, don't use attribute. score depends on length. SEE getScore and SCORES
    
    
    public int getScore(){
      return SCORES[distance];
    }
    
    
    public Graph.COLOR[] getColor_c(){
      int[] col_i = getColor_i();
      Graph.COLOR[] out = new Graph.COLOR[col_i.length];
      int i = 0;
      
      for(int c : col_i){
        out[i] = Graph.COLOR.values()[c];
      }
      return out;
    }
    
    
    public int[] getColor_i(){
      if(dual){       //54 -> floor(54/10) = 5.0, 54-floor(54/10)*10 = 4
        int[] out = {(int) Math.floor(color/10), (int) (color-Math.floor(color/10)*10)};
        return out;
      }
      else{
        int[] out = {color, -1};
        return out;
      }
    }
  }
